-
Notifications
You must be signed in to change notification settings - Fork 10
use doctrine migration factory #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for the PR! Just to clarify and because I never used services in migrations and therefore never used this: Is this correct? When looking into the docs it seems they recommend using a decorator and a compiler pass to add these services. https://symfony.com/bundles/DoctrineMigrationsBundle/current/index.html#migration-dependencies Maybe our config here is wrong and we should also decorate the base class 🤔 |
Yes, this is actually what we did in our case. If you would also create a decorator and make it possible to inject services in the migrations, that would be great 👍 |
|
@DanielBadura yes. The DependencyFactory service is using a default . Having the default does not allow decorating the service. |
|
But that is only the fallback if no service is found in the container given. https://github.com/doctrine/migrations/blob/3.9.x/src/DependencyFactory.php#L435-L439 I assume that, when using with the doctrine-bundle and symfony, this fallback will not be used. |
|
@DanielBadura here you have an application which reproduce the mentioned error: https://github.com/tuxes3/event-sourcing-migration-factory-test-app As you can see I have 2 migrations directories: /var/www $ php bin/console doctrine:m:m -n
[notice] Migrating up to DoctrineMigrations\Version20250602160109
^ "value"
/var/www $ php bin/console event:m:m -n
[notice] Migrating up to App\MigrationsEventSourcing\Version20250602110811
^ nullPlease ask if you need anymore help to reproduce! |
|
Hey, thanks for the PR and your time! We can't simply use the We might not need to change anything and wanted to discuss another option with you. Since we want to be independent of Doctrine Bundles for now, we've registered many things ourselves as services, such as some CLI commands and migration. However, you have the option to switch to the Doctrine Bundle system by activating the https://event-sourcing-bundle.patchlevel.io/latest/configuration/#merge-orm-schema What happens then is that we no longer register the Schema/Migration Service ourselves, but use everything from the Doctrine Bundle. This should also work for injecting the service. If you're already using DoctrineBundle, wouldn't it make sense to switch to their system? Then you can use all of Doctrine Bundle's features. The name |
|
@DavidBadura Hi 👋 Thanks for your input. I will add
This is good to know. Maybe as a suggestion you can add this to your docs as a information/notice to let other developers know, why you have this migration system (If it's not already in there, maybe I wasn't able to find it 😄) |
|
Yes, we will update the documentation and rename the option. Before we change that, I like to hear your feedback on whether this helped. |
|
@robinlehrmann @tuxes3 did the option |
|
@DanielBadura We haven't got round to testing it yet. But I will let you know as soon as we know more. |
|
@DanielBadura @DavidBadura FYI. The activation of the setting |
|
Alright, great to hear. We will then work on the documentation part to be more clear what the options does. Will close this PR then. |
when trying to use symfony services in the event-sourcing migration it would have never used my custom migration factory.
this fix changes that.